<%@ page language="java" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="basePath" value="<%=request.getContextPath() %>"></c:set>
<!DOCTYPE HTML>
<html>
<head>
	<title>正安</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="http://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
	<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/css/bootstrap-editable.css" rel="stylesheet"/>
	<link href="${basePath}/css/main.css" rel="stylesheet">
	<link href="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.css" rel="stylesheet">
	<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" />
	<link href="https://cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.theme.min.css" rel="stylesheet">
	<link href="https://cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet">
	<script src="http://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min.js"></script>
	<script src="http://cdn.bootcss.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
	<script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/bootstrap-table.min.js"></script>
	<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/bootstrap3-editable/js/bootstrap-editable.min.js"></script>
	<script src="https://cdn.bootcss.com/bootstrap-table/1.12.1/locale/bootstrap-table-zh-CN.min.js"></script>
	<script src="${basePath}/js/bootstrap-table-editable.js"></script>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js"></script>
	<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
</head> 
<body>
	<div class="navbar navbar-duomi navbar-static-top" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<a class="navbar-brand" >正安药品仓库管理系统
				</a>
			</div>
		</div>
	</div>
	
	<div class="container-fluid">
		<div class="row">
			<div class="col-md-2">
				<ul id="main-nav" class="nav nav-tabs nav-stacked" style="">
				<li id="employee"><a href="#ee" class="nav-header collapsed"
						data-toggle="collapse"> <i class="glyphicon glyphicon-user"></i>
							{{name}} <span class="pull-right glyphicon glyphicon-chevron-down"></span>
					</a>
						<ul id="ee" class="nav nav-list collapse secondmenu"
							style="height: 0px;">
							<li><a href="<%=request.getContextPath()%>/logout/go"><span class="text-danger">注销</span></a></li>
							<li><a href="#" onclick="showPasswordEdit()"><span class="text-danger">修改密码</span></a></li>
						</ul></li>
					<li><a href="#" onclick="showMedicineStorage()"> <i
							class="glyphicon glyphicon-credit-card"></i> 药品入库
					</a></li>
					<li><a href="#" onclick="showMedicinePutaway()"> <i
							class="glyphicon glyphicon-globe"></i> 药品上架 
					</a></li>
					<li><a href="#" onclick="showMedicineTake()"> <i
							class="glyphicon glyphicon-calendar"></i> 药品领取
					</a></li>
					<li><a href="#systemSetting" class="nav-header collapsed"
						data-toggle="collapse"> <i class="glyphicon glyphicon-cog"></i>
							系统管理 <span class="pull-right glyphicon glyphicon-chevron-down"></span>
					</a>
						<ul id="systemSetting" class="nav nav-list collapse secondmenu"
							style="height: 0px;">
							<li><a href="#" onclick="showSupplierTable()"><i class="glyphicon glyphicon-user"></i>&nbsp;供应商</a></li>
							<li><a href="#" onclick="showMedicineTable()"><i class="glyphicon glyphicon-th-list"></i>&nbsp;药品</a></li>
						</ul></li>
				</ul>
			</div>
			<div class="col-md-10" id="main_right"></div>
		</div>
	</div>
	<div v-show="isVisiable" id="dialog" v-bind:title="title">
  		
	</div>
</body>
<script type="text/javascript">


  
  	var dialog = new Vue({
  	
  		el : '#dialog',
  		data:{
  			title:'正安',
  			isVisiable:false
  		},
  		methods:{
  			showDialog:function(result){
  				this.isVisiable=true;
  				$( "#dialog" ).html(result);
  				$( "#dialog" ).dialog();

  			},
  			disableDialog:function(){
  				this.isVisiable = false;
  				$( "#dialog" ).dialog('close');
  			}
  		}
  	});

	var employee = new Vue({
		el : '#employee',
		data:{
			name : '${employee.name}',
			id : '${employee.id}',
			tel : '${employee.number}'
		}
		
	});
	var storageData = [];
	var supplierId;
	var supplierName;
	var showStoragePrice = function(data,supplierId1,supplierName1){
		//本地缓存入库数据
		storageData = data.slice();
		supplierId = supplierId1;
		supplierName = supplierName1;
		$.ajax({
			url:"${basePath}/ms/price",
			type:"get",
			async:true,
			success:function(result){
				$("#main_right").html(result);
				$( "#dialog" ).dialog();
				$( "#dialog" ).dialog('close');
			}
		})
	};	
	var showMedicineStorage = function(){
		$.ajax({
			url:"${basePath}/m/storage",
			type:"get",
			async:true,
			success:function(result){
				$("#main_right").html(result);
				$( "#dialog" ).dialog();
				$( "#dialog" ).dialog('close');
			}
		})
	};
	var showMedicinePutaway = function(){
		$.ajax({
			url:"${basePath}/m/putaway",
			type:"get",
			async:true,
			success:function(result){
				$("#main_right").html(result);
				$( "#dialog" ).dialog();
				$( "#dialog" ).dialog('close');
			}
		})
	};
	var showMedicineTake = function(){
		$.ajax({
			url:"${basePath}/m/take",
			type:"get",
			async:true,
			success:function(result){
				$("#main_right").html(result);
				$( "#dialog" ).dialog('close');
			}
		})
	};
	var showMedicineTable = function(){
		$.ajax({
			url:"${basePath}/m/list",
			type:"get",
			async:true,
			success:function(result){
				$("#main_right").html(result);
				$( "#dialog" ).dialog();
				$( "#dialog" ).dialog('close');
			}
		})
	};
	var showSupplierTable = function(){
		$.ajax({
			url:"${basePath}/s/list",
			type:"get",
			async:true,
			success:function(result){
				$("#main_right").html(result);
				$( "#dialog" ).dialog();
				$( "#dialog" ).dialog('close');
			}
		})
	};
	
	var showPasswordEdit = function(){
		$.ajax({
			url:"${basePath}/e/edit/password",
			type:"get",
			async:true,
			success:function(result){
				dialog.showDialog(result);
			}
		})
	};
	var showInit = function(){
		$("#main_right").html('');
	};
	
	var speak = function(message){
    		var msg = new SpeechSynthesisUtterance(message);
   			 msg.volume = 100;
   			 msg.rate = 1.25;
   			 msg.pitch = 1.5;
   			 window.speechSynthesis.speak(msg);
	}
</script>
</html>